package com.bzkj.basicinfo.service.impl;

import com.bzkj.basicinfo.domain.basic.BillsTypeMapEntity;
import com.bzkj.basicinfo.domain.ncc.NccBasicBillsTypeEntity;
import com.bzkj.basicinfo.mapper.BillsTypeMapMapper;
import com.bzkj.basicinfo.service.BillsTypeMapService;
import com.bzkj.common.core.domain.AjaxResult;
import com.bzkj.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wl
 * @description 针对表【bills_type_map(单据类型二次分类)】的数据库操作Service实现
 * @createDate 2025-01-17 14:45:32
 */
@Service
public class BillsTypeMapServiceImpl implements BillsTypeMapService
{

    @Autowired
    private BillsTypeMapMapper billsTypeMapMapper;

    /**
     * 获取单据类型树
     * @return
     */
    @Override
    public R findBillsTree()
    {
        List<NccBasicBillsTypeEntity> list =  billsTypeMapMapper.findBillsTree();
        return R.ok(list);
    }

    /**
     * 新增单据二次分类信息
     * @param entity
     * @return
     */
    @Override
    public AjaxResult saveBills(BillsTypeMapEntity entity)
    {
        billsTypeMapMapper.saveBills(entity);
        return AjaxResult.success("新增成功");
    }
    /**
     * 新增单据二次分类信息
     * @param entity
     * @return
     */
    @Override
    public AjaxResult updateBills(BillsTypeMapEntity entity)
    {
        billsTypeMapMapper.updateBillsById(entity);
        return AjaxResult.success("修改成功");
    }

    /**
     * 修改单据二次分类状态
     * @param id
     * @param enableStatus
     * @return
     */
    @Override
    public R putBillsEnableStatus(Integer id, Integer enableStatus)
    {
        billsTypeMapMapper.putBillsEnableStatus(id,enableStatus);
        return R.ok("修改成功");
    }
}




